package com.steel.yfmall.cloud.assistant.view.impl;

import com.alibaba.fastjson.JSONObject;
import com.steel.yfmall.cloud.assistant.utils.zg.ZgViewUtil;
import com.steel.yfmall.cloud.assistant.view.ReceivingGoodsBeanService;
import com.steel.yfmall.cloud.assistant.zg.ZgSOService;
import com.steel.yfmall.cloud.assistant.dto.para.view.ParaReceivingGoodsBean;
import com.steel.yfmall.cloud.assistant.dto.zg.SynZgResult;
import com.steel.yfmall.cloud.assistant.dto.zg.ZgSOResultBean;
import com.steel.yfmall.cloud.assistant.dto.zg.ZgViewBean;
import com.steel.yfmall.cloud.assistant.po.view.ReceivingGoodsBean;
import com.steel.yfmall.cloud.assistant.po.view.ReceivingGoodsBeanExample;
import com.steel.yfmall.cloud.assistant.po.view.ReceivingGoodsBeanExample.Criteria;
import com.steel.yfmall.cloud.assistant.view.mapper.ReceivingGoodsBeanMapper;
import com.steel.yfmall.cloud.components.utils.base.APIMsgBean;
import com.steel.yfmall.cloud.components.utils.base.Pages;
import com.steel.yfmall.cloud.components.utils.base.ResponseCode;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;

import javax.annotation.Resource;
import java.util.*;


/**
 * 收货人管理数据同步
 *
 * @author jia chang bao
 * @date 2020/11/10 13:57
 */
@Service
@Slf4j
public class ReceivingGoodsBeanServiceImpl implements ReceivingGoodsBeanService {
    @Resource
    ReceivingGoodsBeanMapper receivingGoodsBeanMapper;

    @Resource
    ZgSOService zgSOService;

    /**
     * 查询收货人管理数据总条数
     *
     * @param paraReceivingGoodsBean 查询参数
     * @return 总条数
     */
    @Override
    public long getReceivingGoodsBeanCount(ParaReceivingGoodsBean paraReceivingGoodsBean) {
        ReceivingGoodsBeanExample receivingGoodsBeanExample = new ReceivingGoodsBeanExample();
        Criteria criteria = receivingGoodsBeanExample.createCriteria();
        //判断是否为空
        if (!ObjectUtils.isEmpty(paraReceivingGoodsBean)) {
            getSearchData(criteria, paraReceivingGoodsBean);
        }
        return receivingGoodsBeanMapper.countByExample(receivingGoodsBeanExample);
    }

    /**
     * 分页查询收货人管理数据
     *
     * @param paraReceivingGoodsBean 查询参数
     * @return 分页结果
     */
    @Override
    public Pages<ReceivingGoodsBean> getReceivingGoodsBeanOfPage(ParaReceivingGoodsBean paraReceivingGoodsBean) {
        Pages<ReceivingGoodsBean> returnBean = new Pages<>();
        //判断入参是否为空
        if (ObjectUtils.isEmpty(paraReceivingGoodsBean)) {
            return returnBean;
        }
        //条件
        ReceivingGoodsBeanExample receivingGoodsBeanExample = new ReceivingGoodsBeanExample();
        Criteria criteria = receivingGoodsBeanExample.createCriteria();
        getSearchData(criteria, paraReceivingGoodsBean);
        //总条数
        long result_count_int = getReceivingGoodsBeanCount(paraReceivingGoodsBean);
        //设置分页信息
        returnBean.paging(paraReceivingGoodsBean.getCurrentPage(), paraReceivingGoodsBean.getPageSize(), result_count_int);
        receivingGoodsBeanExample.limit(returnBean.getStartPosition(), paraReceivingGoodsBean.getPageSize());
        //判断是否有排序规则
        if (StringUtils.isNotBlank(paraReceivingGoodsBean.getOrderByValue())) {
            receivingGoodsBeanExample.setOrderByClause(paraReceivingGoodsBean.getOrderByValue());
        }
        //分页结果
        List<ReceivingGoodsBean> receivingGoodsBeans = receivingGoodsBeanMapper.selectByExample(receivingGoodsBeanExample);
        //封装返回
        returnBean.setList(receivingGoodsBeans);
        return returnBean;
    }

    /**
     * 分页查询收货人信息数
     *
     * @param paraReceivingGoodsBean 查询参数
     * @return 分页结果
     */
    @Override
    public List<ReceivingGoodsBean> getReceivingGoodsBeanOfList(ParaReceivingGoodsBean paraReceivingGoodsBean) {
        ReceivingGoodsBeanExample receivingGoodsBeanExample = new ReceivingGoodsBeanExample();
        Criteria criteria = receivingGoodsBeanExample.createCriteria();
        //如果参数为空返回空
        if (ObjectUtils.isEmpty(paraReceivingGoodsBean)) {
            return null;
        }
        getSearchData(criteria, paraReceivingGoodsBean);
        return receivingGoodsBeanMapper.selectByExample(receivingGoodsBeanExample);
    }

    /***
     * 添加收货人管理数据
     * @param receivingGoodsBeans 参数信息
     * @return 受影响行数
     */
    @Override
    public int addReceivingGoodsBeanOfList(List<ReceivingGoodsBean> receivingGoodsBeans) {
        if (CollectionUtils.isEmpty(receivingGoodsBeans)) {
            return 0;
        }
        return receivingGoodsBeanMapper.batchInsertByList(receivingGoodsBeans);
    }

    /***
     * 修改收货人管理数据
     * @param receivingGoodsBean 参数数据
     * @return 受影响行数
     */
    @Override
    public int updataReceivingGoodsBean(ReceivingGoodsBean receivingGoodsBean) {
        if (ObjectUtils.isEmpty(receivingGoodsBean)) {
            return 0;
        }
        //条件
        ReceivingGoodsBeanExample receivingGoodsBeanExample = new ReceivingGoodsBeanExample();
        Criteria criteria = receivingGoodsBeanExample.createCriteria();
        criteria.andIdEqualTo(receivingGoodsBean.getId()).andCustNoEqualTo(receivingGoodsBean.getCustNo()).andRecOrderNoEqualTo(receivingGoodsBean.getRecOrderNo());
        return receivingGoodsBeanMapper.updateByExampleSelective(receivingGoodsBean, receivingGoodsBeanExample);
    }

    /***
     * 删除收货人管理数据
     * @param paraReceivingGoodsBean 参数信息
     * @return 受影响行数
     */
    @Override
    public int deleteReceivingGoodsBean(ParaReceivingGoodsBean paraReceivingGoodsBean) {
        //条件为空时不删除
        if (ObjectUtils.isEmpty(paraReceivingGoodsBean)) {
            return 0;
        }
        //条件
        ReceivingGoodsBeanExample receivingGoodsBeanExample = new ReceivingGoodsBeanExample();
        Criteria criteria = receivingGoodsBeanExample.createCriteria();
        getSearchData(criteria, paraReceivingGoodsBean);
        return receivingGoodsBeanMapper.deleteByExample(receivingGoodsBeanExample);
    }

    /***
     * 根据主键批量删除收货人管理数据
     * @param paraReceivingGoodsBeans 参数信息
     * @return 受影响行数
     */
    @Override
    public int deleteReceivingGoodsBeanOfList(List<ParaReceivingGoodsBean> paraReceivingGoodsBeans) {
        if (CollectionUtils.isEmpty(paraReceivingGoodsBeans)) {
            return 0;
        }
        //条件为主键id
        ReceivingGoodsBeanExample receivingGoodsBeanExample = new ReceivingGoodsBeanExample();
        Criteria criteria = receivingGoodsBeanExample.createCriteria();
        Map<Integer, String> conditionMap = new HashMap<>();
        for (ParaReceivingGoodsBean paraReceivingGoodsBean : paraReceivingGoodsBeans) {
            conditionMap.put(paraReceivingGoodsBean.getId(), "");
        }
        criteria.andIdIn(new ArrayList<>(conditionMap.keySet()));
        return receivingGoodsBeanMapper.deleteByExample(receivingGoodsBeanExample);
    }

    /**
     * 同步数据
     *
     * @return 同步结果
     * @param zgViewBean
     */
    @Override
    public APIMsgBean synchronizationZgeCustomerSettlement(ZgViewBean zgViewBean) {

        APIMsgBean serviceDataBean = new APIMsgBean();
        //默认失败
        serviceDataBean.setSoaStateBean(ResponseCode.buildEnumErrorSOAStateBean("数据同步失败"));
        //参数校验
        String msg = checkData(zgViewBean);
        if (!StringUtils.isBlank(msg)) {
            serviceDataBean.setSoaStateBean(ResponseCode.buildEnumErrorSOAStateBean(msg));
            return serviceDataBean;
        }

        SynZgResult synZgResult = new SynZgResult();
        //同步计时开始
        long begintime = System.currentTimeMillis();
        ZgSOResultBean viewData = zgSOService.getViewData(zgViewBean);
        //同步计时结束
        long endtime = System.currentTimeMillis();
        long costTime = (endtime - begintime);
        //请求中冠成功后
        if ("Y".equals(viewData.getIsSuccess())) {
            List<ReceivingGoodsBean> receivingGoodsBeans = null;
            try {
                receivingGoodsBeans = JSONObject.parseArray(viewData.getData(), ReceivingGoodsBean.class);
            } catch (Exception e) {
                serviceDataBean.setSoaStateBean(ResponseCode.buildEnumErrorSOAStateBean("收货人信息数据同步解析出错"));
                log.error("收货人信息数据同步解析出错，错误信息：" , e);
            }
            //检查数据库是否有重复,过滤掉重复信息并设置创建、更新、版本信息
            receivingGoodsBeans = checkDataBase(receivingGoodsBeans);
            if (!CollectionUtils.isEmpty(receivingGoodsBeans)) {
                //批量新增
                int i = addReceivingGoodsBeanOfList(receivingGoodsBeans);
                if (i > 0) {
                    //设置同步所用时间
                    synZgResult.setSynTime(String.valueOf(costTime));
                    //设置同步条数
                    synZgResult.setCountNum(i);
                    //设置同步状态
                    synZgResult.setState(true);
                    serviceDataBean.setSoaStateBean(ResponseCode.buildEnumSuccessSOAStateBean("数据同步成功"));
                    serviceDataBean.setData(synZgResult);
                    //日志记录
                    log.info("收货人信息数据同步成功，本次同步" + i + "条数据,耗时" + costTime + "毫秒");
                }
            } else {
                log.info("无数据同步");
                serviceDataBean.setSoaStateBean(ResponseCode.buildEnumErrorSOAStateBean("无数据同步"));
            }
        } else {
            serviceDataBean.setSoaStateBean(ResponseCode.buildEnumErrorSOAStateBean(viewData.getMsg()));
        }
        //递归同步
        try {
            //起始页
            int startPage = Integer.parseInt(zgViewBean.getPageNum());
            //判断是否还有数据
            if (startPage < viewData.getZgpageData().getPages()) {
                startPage++;
                zgViewBean.setPageNum(String.valueOf(startPage));
                synchronizationZgeCustomerSettlement(zgViewBean);
            }
        } catch (Exception e) {
            serviceDataBean.setSoaStateBean(ResponseCode.buildEnumErrorSOAStateBean("收货人信息数据递归同步出错"));
            log.error("收货人信息数据递归同步出错，错误信息：" , e);
        }
        return serviceDataBean;
    }

    /***
     * 检查数据库中数据是否存在，将不存在的数据返回，过滤掉重复的数据
     * @param receivingGoodsBeans 需要检查的数据
     * @return List<ReceivingGoodsBean> 过滤剩余的数据
     */

    public List<ReceivingGoodsBean> checkDataBase(List<ReceivingGoodsBean> receivingGoodsBeans) {
        if (CollectionUtils.isEmpty(receivingGoodsBeans)) {
            return null;
        }
        //拼接条件，由于需要使用CustNo和RecOrderNo才能判定是否唯一，这里进行拼接
        ReceivingGoodsBeanExample receivingGoodsBeanExample = new ReceivingGoodsBeanExample();
        Criteria criteria = receivingGoodsBeanExample.createCriteria();
        Map<String, ReceivingGoodsBean> receivingGoodsBeanMap = new HashMap<>();
        for (ReceivingGoodsBean receivingGoodsBean : receivingGoodsBeans) {
            String onlyKey = receivingGoodsBean.getCustNo() + "," + receivingGoodsBean.getRecOrderNo();
            receivingGoodsBeanMap.put(onlyKey, receivingGoodsBean);
        }
        //查询数据库是否有重复数据
        ArrayList<String> onlykey = new ArrayList<>(receivingGoodsBeanMap.keySet());
        List<String> custNoList = new ArrayList<>();
        List<String> recOrderNoList = new ArrayList<>();
        for (String key : onlykey) {
            String[] split = key.split(",");
            custNoList.add(split[0]);
            recOrderNoList.add(split[1]);
        }
        criteria.andCustNoIn(custNoList);
        criteria.andRecOrderNoIn(recOrderNoList);
        List<ReceivingGoodsBean> receivingGoodsBeans1 = receivingGoodsBeanMapper.selectByExample(receivingGoodsBeanExample);
        //存放重复的数据
        List<ReceivingGoodsBean> oldReceivingGoodsBean = new ArrayList<>();
        //用数据库的数据和同步过来的数据进行比对
        for (ReceivingGoodsBean receivingGoodsBean : receivingGoodsBeans1) {
            String dbKey = receivingGoodsBean.getCustNo() + "," + receivingGoodsBean.getRecOrderNo();
            if (receivingGoodsBeanMap.containsKey(dbKey)) {
                oldReceivingGoodsBean.add(receivingGoodsBeanMap.get(dbKey));
                receivingGoodsBeanMap.remove(dbKey);
            }
        }
        //不重复的数据
        receivingGoodsBeans = new ArrayList<>(receivingGoodsBeanMap.values());
        for (int i = 0; i < receivingGoodsBeans.size(); i++) {
            receivingGoodsBeans.get(i).setCreateTime(new Date());
            receivingGoodsBeans.get(i).setUpdateTime(new Date());
            receivingGoodsBeans.get(i).setVersionInt(0);
            // receivingGoodsBeans.get(i).setInputCode("N");
        }
        //当存在重复数据时
        if (!CollectionUtils.isEmpty(oldReceivingGoodsBean)) {
            //复用对象
            receivingGoodsBeanMap.clear();
            for (ReceivingGoodsBean receivingGoodsBean : oldReceivingGoodsBean) {
                String dbKey = receivingGoodsBean.getCustNo() + "," + receivingGoodsBean.getRecOrderNo();
                receivingGoodsBeanMap.put(dbKey, receivingGoodsBean);
            }
            //细致比对取出差异数据然后线程修改
            List<ReceivingGoodsBean> receivingGoodsBeansList = equlstDateChange(receivingGoodsBeanMap);
            if (!CollectionUtils.isEmpty(receivingGoodsBeansList)) {
                AsynchronousUpDate asynchronousUpDate = new AsynchronousUpDate(receivingGoodsBeansList);
                new Thread(asynchronousUpDate).start();
            }
        }
        return receivingGoodsBeans;
    }

    /**
     * @param reachRegionBeanMap 重复的数据
     * @return List<ReachRegionBean> 重复且有差异的信息
     * @Description 校验比较返回重复且有差异的的信息
     * @author jia chang bao
     * @date 2020/11/9 17:17
     */
    private List<ReceivingGoodsBean> equlstDateChange(Map<String, ReceivingGoodsBean> reachRegionBeanMap) {
        if (reachRegionBeanMap.isEmpty()) {
            return null;
        }
        //将条件分割查询出重复的数据进行比对
        ReceivingGoodsBeanExample receivingGoodsBeanExample = new ReceivingGoodsBeanExample();
        Criteria criteria = receivingGoodsBeanExample.createCriteria();
        ArrayList<String> onlykey = new ArrayList<>(reachRegionBeanMap.keySet());
        List<String> custNoList = new ArrayList<>();
        List<String> recOrderNoList = new ArrayList<>();
        for (String key : onlykey) {
            String[] split = key.split(",");
            custNoList.add(split[0]);
            recOrderNoList.add(split[1]);
        }
        criteria.andCustNoIn(custNoList);
        criteria.andRecOrderNoIn(recOrderNoList);
        //重复的数据
        List<ReceivingGoodsBean> receivingGoodsBeans = receivingGoodsBeanMapper.selectByExample(receivingGoodsBeanExample);
        //需要修改的数据
        List<ReceivingGoodsBean> receivingGoodsBeanList = new ArrayList<>();
        //用数据库出来的数和重复的数据进行比对，如果发现有不一致的数判定为需要修改的重复数据
        for (ReceivingGoodsBean receivingGoodsBean : receivingGoodsBeans) {
            String dbKey = receivingGoodsBean.getCustNo() + "," + receivingGoodsBean.getRecOrderNo();
            if (reachRegionBeanMap.containsKey(dbKey)) {
                ReceivingGoodsBean receivingGoodsBean1 = reachRegionBeanMap.get(dbKey);
                //比较数据，当有一项重复则判定为需要修改
                if (!receivingGoodsBean1.getRecOrderNo().equals(receivingGoodsBean.getRecOrderNo())
                        || !receivingGoodsBean1.getRecName().equals(receivingGoodsBean.getRecName())
                        || !receivingGoodsBean1.getRecShortName().equals(receivingGoodsBean.getRecShortName())
                        || !receivingGoodsBean1.getContactMan().equals(receivingGoodsBean.getContactMan())
                        || !receivingGoodsBean1.getPhone().equals(receivingGoodsBean.getPhone())
                        || !receivingGoodsBean1.getSiteNo().equals(receivingGoodsBean.getSiteNo())
                        || !receivingGoodsBean1.getAreaNo().equals(receivingGoodsBean.getAreaNo())
                        || !receivingGoodsBean1.getZipCode().equals(receivingGoodsBean.getZipCode())
                        || !receivingGoodsBean1.getStatus().equals(receivingGoodsBean.getStatus())
                        || !receivingGoodsBean1.getProvince().equals(receivingGoodsBean.getProvince())
                        || !receivingGoodsBean1.getCity().equals(receivingGoodsBean.getCity())
                        || !receivingGoodsBean1.getConty().equals(receivingGoodsBean.getConty())
                        || !receivingGoodsBean1.getRecAddr().equals(receivingGoodsBean.getRecAddr())
                ) {
                    receivingGoodsBean1.setId(receivingGoodsBean.getId());
                    receivingGoodsBean1.setUpdateTime(new Date());
                    receivingGoodsBean1.setVersionInt(receivingGoodsBean.getVersionInt() + 1);
                    receivingGoodsBeanList.add(receivingGoodsBean1);
                }
            }
        }
        //需要需改的重复数据
        return receivingGoodsBeanList;
    }

    /***
     * 线程修改数据
     */
    private class AsynchronousUpDate implements Runnable {
        List<ReceivingGoodsBean> receivingGoodsBeans;

        public AsynchronousUpDate(List<ReceivingGoodsBean> receivingGoodsBeans) {
            this.receivingGoodsBeans = receivingGoodsBeans;
        }

        @Override
        public void run() {
            try {
                if (!CollectionUtils.isEmpty(receivingGoodsBeans)) {
                    //记录总需改数据
                    int i = 0;
                    long begintime = System.currentTimeMillis();
                    for (ReceivingGoodsBean receivingGoodsBean : receivingGoodsBeans) {
                        i += updataReceivingGoodsBean(receivingGoodsBean);
                    }
                    long endtime = System.currentTimeMillis();
                    long costTime = (endtime - begintime);
                    log.info("异步修改收货人信息成功，本次修改" + i + "条数据，耗时" + costTime + "毫秒");
                }
            } catch (Exception e) {
                log.error("同步后的差异数据修改失败，错误原因：" , e);
            }
        }
    }


    /**
     * sql拼接
     *
     * @param criteria               sql拼接
     * @param paraReceivingGoodsBean 参数
     */
    private void getSearchData(Criteria criteria, ParaReceivingGoodsBean paraReceivingGoodsBean) {
        // ID
        if (paraReceivingGoodsBean.getId() != null && paraReceivingGoodsBean.getId() > 0) {
            criteria.andIdEqualTo(paraReceivingGoodsBean.getId());
        }
        //动作(N:新增、R：修改、D:删除)
        if (StringUtils.isNotBlank(paraReceivingGoodsBean.getInputCode())) {
            //   criteria.andInputCodeEqualTo(paraReceivingGoodsBean.getInputCode());
        }
        //客户编号
        if (StringUtils.isNotBlank(paraReceivingGoodsBean.getCustNo())) {
            criteria.andCustNoEqualTo(paraReceivingGoodsBean.getCustNo());
        }
        //收货人序号
        if (StringUtils.isNotBlank(paraReceivingGoodsBean.getRecOrderNo())) {
            criteria.andRecOrderNoEqualTo(paraReceivingGoodsBean.getRecOrderNo());
        }
        //收货人名称
        if (StringUtils.isNotBlank(paraReceivingGoodsBean.getRecName())) {
            criteria.andRecNameEqualTo(paraReceivingGoodsBean.getRecName());
        }
        //收货人简称
        if (StringUtils.isNotBlank(paraReceivingGoodsBean.getRecShortName())) {
            criteria.andRecShortNameEqualTo(paraReceivingGoodsBean.getRecShortName());
        }
        //联络人
        if (StringUtils.isNotBlank(paraReceivingGoodsBean.getContactMan())) {
            criteria.andContactManEqualTo(paraReceivingGoodsBean.getContactMan());
        }
        //联络电话
        if (StringUtils.isNotBlank(paraReceivingGoodsBean.getPhone())) {
            criteria.andPhoneEqualTo(paraReceivingGoodsBean.getPhone());
        }
        //联络电话
        if (StringUtils.isNotBlank(paraReceivingGoodsBean.getSiteNo())) {
            criteria.andSiteNoEqualTo(paraReceivingGoodsBean.getSiteNo());
        }
        //终到地区
        if (StringUtils.isNotBlank(paraReceivingGoodsBean.getAreaNo())) {
            criteria.andAreaNoEqualTo(paraReceivingGoodsBean.getAreaNo());
        }
        //邮编区号
        if (StringUtils.isNotBlank(paraReceivingGoodsBean.getZipCode())) {
            criteria.andZipCodeEqualTo(paraReceivingGoodsBean.getZipCode());
        }
        //状态
        if (StringUtils.isNotBlank(paraReceivingGoodsBean.getStatus())) {
            criteria.andStatusEqualTo(paraReceivingGoodsBean.getStatus());
        }
        //省ID
        if (StringUtils.isNotBlank(paraReceivingGoodsBean.getProvince())) {
            criteria.andProvinceEqualTo(paraReceivingGoodsBean.getProvince());
        }
        //市ID
        if (StringUtils.isNotBlank(paraReceivingGoodsBean.getCity())) {
            criteria.andCityEqualTo(paraReceivingGoodsBean.getCity());
        }
        //县区ID
        if (StringUtils.isNotBlank(paraReceivingGoodsBean.getConty())) {
            criteria.andContyEqualTo(paraReceivingGoodsBean.getConty());
        }
        //收货地址
        if (StringUtils.isNotBlank(paraReceivingGoodsBean.getRecAddr())) {
            criteria.andRecAddrEqualTo(paraReceivingGoodsBean.getRecAddr());
        }
        //备注
        if (StringUtils.isNotBlank(paraReceivingGoodsBean.getMemo())) {
            criteria.andMemoEqualTo(paraReceivingGoodsBean.getMemo());
        }
        //创建时间
        if (paraReceivingGoodsBean.getCreateTime() != null) {
            criteria.andCreateTimeEqualTo(paraReceivingGoodsBean.getCreateTime());
        }
        //版本号
        if (paraReceivingGoodsBean.getVersionInt() != null && paraReceivingGoodsBean.getVersionInt() > 0) {
            criteria.andVersionIntEqualTo(paraReceivingGoodsBean.getVersionInt());
        }
        //修改时间
        if (paraReceivingGoodsBean.getUpdateTime() != null) {
            criteria.andUpdateTimeEqualTo(paraReceivingGoodsBean.getUpdateTime());
        }
    }

    /**
     * 中冠视图请求的参数校验
     *
     * @param zgViewBean 视图名称
     * @return 校验结果
     */
    private String checkData(ZgViewBean zgViewBean) {
        String msg = "";
        if (!StringUtils.isNotBlank(zgViewBean.getMethod())) {
            msg += "请求方法不能为空";
        }
        if (!StringUtils.isNotBlank(zgViewBean.getViewId())) {
            msg += "请求的视图不能为空";
        }
        if (!StringUtils.isNotBlank(zgViewBean.getPageNum())) {
            msg += "请求的页码不能为空";
        }
        return msg;
    }


    /**
     * 查询用户收货地址信息
     * @Title: getReceivingGoodsBeanByPara
     * @Description: (这里用一句话描述这个方法的作用)
     * @Param paraBean 参数说明
     * @return com.steel.yfmall.cloud.assistant.po.view.ReceivingGoodsBean    返回类型
     * @author yuchaohua
     * @date 2021/1/21 23:28
     */
    @Override
    public ReceivingGoodsBean getReceivingGoodsBeanByPara(ParaReceivingGoodsBean paraBean) {
        //判断入参是否为空
        if (paraBean == null) {
            return null;
        }
        //条件
        ReceivingGoodsBeanExample example = new ReceivingGoodsBeanExample();
        Criteria criteria = example.createCriteria();
        getSearchData(criteria, paraBean);
        return receivingGoodsBeanMapper.selectOneByExampleSelective(example);
    }

}
